<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"  %>
<%@ include file="base.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>${requestScope.tie.title }</title>
<link rel="stylesheet" type="text/css" href="${basePath }/style/style.css"/>
<style type="text/css" >
			span{
				display:none;
			}
		</style>
		<script type="text/javascript" src="${basePath }/script/jquery-1.3.2.min.js"></script>
					<script type="text/javascript" charset="utf-8" src="${basePath }/script/kindeditor-min.js"></script>
	<script type="text/javascript">
		KE.show({
			id : 'replay_content',
				allowPreviewEmoticons : true,
				allowUpload : true,
				imageUploadJson:'${basePath}/script/ke/upload_json.jsp',
				items : [
				'fontname', 'fontsize', '|', 'textcolor', 'bgcolor', 'bold', 'italic', 'underline',
				'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
				'insertunorderedlist', '|', 'emoticons', 'image', 'link']
		});
	</script>
		<script type="text/javascript">
			$(document).ready(function(){
				$("#replyForm").submit(function(){
					if(!$.trim($(".replay_title").val())){
						//$(".replay_title").val("不能为空");
						$("#titlemsg").css("display","block");
						return false;
					}
					if(!$.trim($(".replay_content").val())){
					 	//$(".replay_content").val("不能为空");
					 	$("#contentmsg").css("display","block");
					 	return false;
					}
					return true;
				});
			});
		</script>
</head>

<body>
<%@include file="template/top.jsp" %>


<div id="contain">
	<div class="nav">
    	<a href="index.jspx">论坛首页</a>
        &gt;
        <a href="type.jspx?_method=list&id=${requestScope.tie.type.id }">${requestScope.tie.type.name } </a>
        &gt;
        <a href="#">${requestScope.tie.title }</a>
  </div>	
	<table class="post_table" border="0" cellpadding="0" cellspacing="1">
    	<thead>
        	<tr>
            	<th class="author_msg">作者</th>
                <th class="posts_content">正文</th>
            </tr>
           
            	

        </thead>
        <tbody>
        	
           
            <c:forEach items="${requestScope.tielist }" var="r" varStatus="s">
            <tr>
            	<td class="author_msg_td">
               	  	<div class="pic">
                   		 <img src="${basePath }/upload/${r.user.pic}" width="80" height="80"/>
                    </div>
                    <h3>${r.user.name }</h3>
                    <h4>加入时间 ${r.user.regTime }</h4>
                    <h4>发帖数量：${r.user.tieNum }</h4>
                </td>
                <td align="left" valign="top" class="posts_content_td">
               	  <div class="content_msg">
                    	${requestScope.pg.startNum+s.count}楼 ${r.user.name } 发表于${r.createTime }  
                    	<span class="read">${r.clickNum }阅/${r.replyNum }回</span>
                        <a href="#" class="fav">关注</a>
                        <a href="#" class="replay">回复</a>
                  </div>
                	 ${r.content }
                </td>
            </tr>
            </c:forEach>
            
            
        </tbody>
        <tfoot>
        	<tr>
           	  <td class="author_msg_td"></td>
                <td align="right" class="posts_content_td">
                	
   <!-- 分页 -->
  共${requestScope.pg.totalSize }条记录，每页显示${requestScope.pg.pageSize 	}条,共${requestScope.pg.totalPages }页 ，当前第${requestScope.pg.currentPage
		}页
		<c:choose>
			<c:when test="${not requestScope.pg.first}">
				<a href="tie.jspx?_method=detail&p=1&id=${requestScope.tie.id}">首页</a>
			</c:when>
			<c:otherwise>
              	     首页
              	</c:otherwise>
		</c:choose>
		<c:choose>
			<c:when test="${requestScope.pg.prev}">
				<a href="tie.jspx?_method=detail&p=${requestScope.pg.currentPage-1 }&id=${requestScope.tie.id}">上一页</a>
			</c:when>
			<c:otherwise>
              	    上一页
              	</c:otherwise>
		</c:choose>
		<c:choose>
			<c:when test="${requestScope.pg.next}">
				<a href="tie.jspx?_method=detail&p=${requestScope.pg.currentPage+1 }&id=${requestScope.tie.id}">下一页</a>
			</c:when>
			<c:otherwise>
              	    下一页
              	</c:otherwise>
		</c:choose>
		<c:choose>
			<c:when test="${not requestScope.pg.last}">
				<a href="tie.jspx?_method=detail&p=${requestScope.pg.totalPages }&id=${requestScope.tie.id}">尾页</a>
			</c:when>
			<c:otherwise>
              	     尾页
              	</c:otherwise>
		</c:choose>
                </td>
            </tr>
        	<tr>
            	<td class="author_msg_td"></td>
							<td class="posts_content_td">
							<c:choose>
								<c:when test="${not empty sessionScope.user }">
									<form action="tie.jspx" method="post" id="replyForm" >
										<input type="hidden" name="pid" value="${tie.id }" />
										<input type="hidden" name="typeid" value="${tie.type.id }"/>
										<input type="hidden" name="uid"
											value="${sessionScope.user.id }" />
										<input type="hidden" name="_method" value="reply" />
										<a name="replylink">回复</a>
										<label>
											回复标题：
										</label>
										<input type="text" value="回复：${tie.title }" name="title"
											class="replay_title" />
											<span id="titlemsg">标题不能为空</span>
										<label>
											回复内容：
										</label>
										<textarea class="replay_content" id="replay_content" name="content"></textarea>
										<span id="contentmsg">内容不能为空</span>
										<div class="replay_button">
											<input type="submit" value="回复" />
										</div>
									</form>
								</c:when>
								<c:otherwise>
									<a href="index.jspx?_method=login">登录</a>后发表言论
						</c:otherwise>
							</c:choose>
						</td>
					</tr>
        </tfoot>
    </table>
</div>

<%@include file="template/footer.jsp" %>

</body>
</html>

